1 /*
2 AntMake
3
4 Copyright (C) 2004 Jose San Leandro Armend?riz
5 jsanleandro@yahoo.es
6 chousz@yahoo.com
7
8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public
10 License as published by the Free Software Foundation; either
11 version 2 of the License, or (at your option) any later version.
12
13 This library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 General Public License for more details.
17
18 You should have received a copy of the GNU General Public
19 License along with this library; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21
22 Thanks to ACM S.L. for distributing this library under the GPL license.
23 Contact info: jsr000@terra.es
24 Postal Address: c/Playa de Lagoa, 1
25 Urb. Valdecaba?as
26 Boadilla del monte
27 28660 Madrid
28 Spain
29
30 ******************************************************************************
31 This class is based on RedirectingOutputStream
32 included in Ant distribution, and whose license details
33 are the following.
34
35 *
36 * The Apache Software License, Version 1.1
37 *
38 * Copyright (c) 2002 The Apache Software Foundation. All rights
39 * reserved.
40 *
41 * Redistribution and use in source and binary forms, with or without
42 * modification, are permitted provided that the following conditions
43 * are met:
44 *
45 * 1. Redistributions of source code must retain the above copyright
46 * notice, this list of conditions and the following disclaimer.
47 *
48 * 2. Redistributions in binary form must reproduce the above copyright
49 * notice, this list of conditions and the following disclaimer in
50 * the documentation and/or other materials provided with the
51 * distribution.
52 *
53 * 3. The end-user documentation included with the redistribution, if
54 * any, must include the following acknowlegement:
55 * "This product includes software developed by the
56 * Apache Software Foundation (http://www.apache.org/)."
57 * Alternately, this acknowlegement may appear in the software itself,
58 * if and wherever such third-party acknowlegements normally appear.
59 *
60 * 4. The names "Ant" and "Apache Software
61 * Foundation" must not be used to endorse or promote products derived
62 * from this software without prior written permission. For written
63 * permission, please contact apache@apache.org.
64 *
65 * 5. Products derived from this software may not be called "Apache"
66 * nor may "Apache" appear in their names without prior written
67 * permission of the Apache Group.
68 *
69 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
70 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
71 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
72 * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
73 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
74 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
75 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
76 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
77 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
78 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
79 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
80 * SUCH DAMAGE.
81 * ====================================================================
82 *
83 * This software consists of voluntary contributions made by many
84 * individuals on behalf of the Apache Software Foundation. For more
85 * information on the Apache Software Foundation, please see
86 * <http://www.apache.org/>.
87 *
88
89 ******************************************************************************
90 *
91 * Filename: $RCSfile: AntMakeTask.java,v $
92 *
93 * Author: Jose San Leandro Armend?riz
94 *
95 * Description: Redirects a stream to the cvs log's output parser.
96 *
97 * Last modified by: $Author: chous $ at $Date: 2004/01/24 11:17:06 $
98 *
99 * File version: $Revision: 1.8 $
100 *
101 * Project version: $Name: $
102 *
103 * $Id: AntMakeTask.java,v 1.8 2004/01/24 11:17:06 chous Exp $
104 *
105 */
106 package org.acmsl.antmake;
107
108 /*
109 * Importing project classes.
110 */
111 import org.acmsl.antmake.ChangeLogParser;
112
113 /*
114 * Importing Ant classes.
115 */
116 import org.apache.tools.ant.taskdefs.LogOutputStream;
117
118 /***
119 * Redirects a stream to the cvs log's output parser.
120 * @author <a href="mailto:jsanleandro@yahoo.es"
121 >Jose San Leandro</a>, based on
122 * <a href="mailto:peter@apache.org">Peter Donald</a>'s
123 * RedirectingOutputStream. It's package-protected, so it had to be
124 * basically copied and pasted.
125 * @version $Revision: 1.8 $
126 * @see org.apache.tools.ant.taskdefs.cvslib.RedirectingOutputStream
127 */
128 public class RedirectingOutputStream
129 extends LogOutputStream
130 {
131 /***
132 * The changelog parser.
133 */
134 private ChangeLogParser m__Parser;
135
136 /***
137 * Creates a stream for given parser.
138 * @param parser the parser to which the output is sent.
139 */
140 public RedirectingOutputStream(final ChangeLogParser parser)
141 {
142 super(null, 0);
143
144 inmutableSetParser(parser);
145 }
146
147 /***
148 * Specifies the parser.
149 * @param parser the changelog parser.
150 */
151 private void inmutableSetParser(ChangeLogParser parser)
152 {
153 m__Parser = parser;
154 }
155
156 /***
157 * Specifies the parser.
158 * @param parser the changelog parser.
159 */
160 protected void setParser(ChangeLogParser parser)
161 {
162 inmutableSetParser(parser);
163 }
164
165 /***
166 * Retrieves the parser.
167 * @return such parser.
168 */
169 protected ChangeLogParser getParser()
170 {
171 return m__Parser;
172 }
173
174 /***
175 * Logs a line to the log system of ant.
176 * @param line the line to log.
177 */
178 protected void processLine(String line)
179 {
180 if (line != null)
181 {
182 ChangeLogParser t_Parser = getParser();
183
184 if (t_Parser != null)
185 {
186 t_Parser.stdout(line);
187 }
188 }
189 }
190 }
191
This page was automatically generated by Maven